package com.zhiyuancode.mqack.message.base;

import com.zhiyuancode.mqack.util.ExceptionUtil;
import lombok.Getter;

import java.util.Objects;


@Getter
public class MqResendRuntimeException extends RuntimeException {
    private String errorId;
    private String simpleErrorMessage;
    private String detailErrorMessage;
    private Object[] params;

    public MqResendRuntimeException(MqResendErrorCode code, Object... params) {
        this(code, null, params);
    }

    public MqResendRuntimeException(MqResendErrorCode code, Throwable cause, Object... params) {
        super(ExceptionUtil.getDetailErrorMessage(code.toString(), cause, params));

        this.errorId = code.getCode();
        this.simpleErrorMessage = code.getMessage() +
                (Objects.nonNull(cause) ? ":" + ExceptionUtil.getSimpleCauseErrorMessage(cause) : "");

        this.detailErrorMessage = getMessage();
        this.params = params;
    }

    @Override
    public synchronized Throwable fillInStackTrace() {
        return null;
    }
}
